/*
 * @Description:
 * @version:
 * @Author: sunqian_sr
 * @Date: 2022-11-24 16:02:16
 * @LastEditors: Andy
 * @LastEditTime: 2022-12-09 17:38:54
 */
export const regexp = {
  email: /^([\w-+]|[\w.+])+@[(\w-+)]+(\.)+([\w]){2,14}$/,
  mobilePhone: /^[1][3-9][0-9]{9}$/,
  userName: /^[a-zA-Z0-9_-]{1,20}$/,
  password: /^(?![A-z0-9]+$)(?=.[^%&',;=?$\x22])(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{8,20}$/,
  validValue: /^[A-Za-z0-9-\u4e00-\u9fa5]+$/, // 中文英文数字 和减号,
  validName: /^[\u4e00-\u9fa5*a-zA-Z0-9]{0,255}$/,
  validGroup: /^[A-Za-z0-9_\-\u4e00-\u9fa5]+$/, // 中文英文数字下划线 和减号,
  validNumber: /^[A-Za-z0-9]{0,255}$/
}

export const isExternal = (path) => {
  return /^(https?:|mailto:|tel:)/.test(path)
}
export const checkPwd = (value) => {
  return regexp.password.test(value)
}
/* 校验用户名 */
export const checkUserName = (value) => {
  return regexp.userName.test(value)
}
/* 电子邮箱 */
export const checkEmail = (value) => {
  return regexp.email.test(value)
}

/* 电子邮箱 */
export const checkMobilePhone = (value) => {
  return regexp.mobilePhone.test(value)
}
